<template>
  <div class="table-form-body-button">
    <el-row>
      <span
        v-for="item in operateInfo"
        :key="item.btnName"
        class="btn-operate-above"
        :sapn="2"
      >
        <el-button
          :type="item.cssType || 'default'"
          v-if="item.location == '2a' && item.btnType != 'import'"
          @click="item.method"
        >
          {{ item.name }}
        </el-button>
        <el-upload
          class="device-upload"
          v-if=" item.btnType == 'import'"
          ref="upload"
          :show-file-list="false"
          action="/device/api/deviceAsset/import"
          :on-success="uploadSuccess"
          :auto-upload="true">
          <el-button   >批量导入</el-button>
        </el-upload>
      </span>
    </el-row>
  </div>
</template>
<script>
import waves from "@/directive/waves"; // waves directive
export default {
  name: "ListOpearteButton2a",
  props:["dataLocation"],
  directives: { waves },
  data() {
    return {
      operateInfo: [],
    };
  },
  watch: {},
  mounted() {
    console.log(this.$store.state.button.currentMenuButton);
    this.operateInfo = this.$store.state.button.currentMenuButton.filter(
      (e) => {
        return e.location == "2a";
      }
    );
  },
  methods: {
    uploadSuccess(e){
      console.log(e,"上传成功")
    }
  },
};
</script>
<style>
.btn-operate-above {
  margin: 0 10px;
}
.device-upload{
  display: inline-block;
}
</style>
